02. Setting up your environment

Setting up your environment

For this project make sure you are using the robo-nd Virtual Machine Image or have Ubuntu+ROS installed locally.

For the rest of this setup, catkin_ws is the name of active ROS Workspace, if your workspace name is different, change the commands accordingly.

If you do not have an active ROS workspace, you can create one by:

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make

Now that you have a workspace, clone or download project repository into the src directory of your workspace:

$ cd ~/catkin_ws/src
$ git clone https://github.com/udacity/RoboND-Kinematics-Project.git

Now we will install missing dependencies using the almighty $ rosdep install command:

$ cd ~/catkin_ws
$ rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y

Next we will change the permissions of script files to turn them executable:

$ cd ~/catkin_ws/src/RoboND-Kinematics-Project/kuka_arm/scripts
$ sudo chmod u+x target_spawn.py
$ sudo chmod u+x IK_server.py
$ sudo chmod u+x safe_spawner.sh

Now that everything is in place, it is time to build the project. From within your workspace you can run catkin_make to build the project:

$ cd ~/catkin_ws
$ catkin_make

Since the pick and place simulator spins up different nodes in separate terminals, you need to add the following to your .bashrc file for auto-sourcing:

$ source ~/catkin_ws/devel/setup.bash

As this project uses custom 3D models, we need to inform Gazebo (our simulation software) where to look for them. Thanks to environment variables, this can be easily accomplished by adding a single line to your .bashrc

Open a terminal window and type in the following:

$ echo "export GAZEBO_MODEL_PATH=~/catkin_ws/src/RoboND-Kinematics-Project/kuka_arm/models" >> ~/.bashrc

For demo mode make sure the demo flag is set to true in inverse_kinematics.launch file under ~/catkin_ws/src/RoboND-Kinematics-Project/kuka_arm/launch/

In addition, you can also control the spawn location of the target object in the shelf. To do this, modify the spawn_location argument in target_description.launch file under ~/catkin_ws/src/RoboND-Kinematics-Project/kuka_arm/launch/

0-9 are valid values for spawn_location with 0 being random mode.

That's it, we have now successfully built our project and are ready to explore it further!